/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "zobjects_gtk.h"

DEFINE_GUICOLUMN_OBJECT(treecolumn_toggle)
DEFINE_GUICOLUMN_OBJECT(treecolumn_progress)
DEFINE_GUICOLUMN_OBJECT(treecolumn_int_text)
DEFINE_GUICOLUMN_OBJECT(treecolumn_double_text)
DEFINE_GUICOLUMN_OBJECT(treecolumn_string_text)

ZlangInvokeFunction ZlangInvokeFunction_guitreenode_Copy;
int ZlangInvokeFunction_guitreenode_Copy( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*copy_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*copy_guitreenode_common = & (copy_guitreenode_direct_prop->common) ;

	copy_guitreenode_common->gtk_widget = guitreenode_common->gtk_widget ;
	memcpy( & (copy_guitreenode_common->tree_iter) , & (guitreenode_common->tree_iter) , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreenode_Up_guitreenode;
int ZlangInvokeFunction_guitreenode_Up_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*up_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*up_guitreenode_common = & (up_guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	unsigned char					bret ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreenode_common->gtk_widget) ) ;
	up_guitreenode_common->gtk_widget = guitreenode_common->gtk_widget ;
	bret = gtk_tree_model_iter_parent( tree_model , & (up_guitreenode_common->tree_iter) , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreenode_Down_guitreenode;
int ZlangInvokeFunction_guitreenode_Down_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*down_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*down_guitreenode_common = & (down_guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	unsigned char					bret ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreenode_common->gtk_widget) ) ;
	down_guitreenode_common->gtk_widget = guitreenode_common->gtk_widget ;
	bret = gtk_tree_model_iter_children( tree_model , & (down_guitreenode_common->tree_iter) , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreenode_Next_guitreenode;
int ZlangInvokeFunction_guitreenode_Next_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*next_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*next_guitreenode_common = & (next_guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	unsigned char					bret ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreenode_common->gtk_widget) ) ;
	next_guitreenode_common->gtk_widget = guitreenode_common->gtk_widget ;
	memcpy( & (next_guitreenode_common->tree_iter) , & (guitreenode_common->tree_iter) , sizeof(GtkTreeIter) );
	bret = gtk_tree_model_iter_next( tree_model , & (next_guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreenode_Prev_guitreenode;
int ZlangInvokeFunction_guitreenode_Prev_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*prev_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*prev_guitreenode_common = & (prev_guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	unsigned char					bret ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreenode_common->gtk_widget) ) ;
	prev_guitreenode_common->gtk_widget = guitreenode_common->gtk_widget ;
	memcpy( & (prev_guitreenode_common->tree_iter) , & (guitreenode_common->tree_iter) , sizeof(GtkTreeIter) );
	bret = gtk_tree_model_iter_previous( tree_model , & (prev_guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	return 0;
}

ZlangCreateDirectPropertyFunction ZlangCreateDirectProperty_guitreenode;
void *ZlangCreateDirectProperty_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreenode	*guitreenode_direct_prop = NULL ;
	
	guitreenode_direct_prop = (struct ZlangDirectProperty_guitreenode *)ZLMALLOC( sizeof(struct ZlangDirectProperty_guitreenode) ) ;
	if( guitreenode_direct_prop == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc memory for entity" )
		return NULL;
	}
	memset( guitreenode_direct_prop , 0x00 , sizeof(struct ZlangDirectProperty_guitreenode) );
	
	return (struct ZlangEntity *)guitreenode_direct_prop;
}

ZlangDestroyDirectPropertyFunction ZlangDestroyDirectProperty_guitreenode;
void ZlangDestroyDirectProperty_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreenode	*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	
	ZLFREE( guitreenode_direct_prop );
	
	return;
}

ZlangToStringFunction ZlangToString_guitreenode;
int ZlangToString_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj , struct ZlangObject **tostr_obj )
{
	struct ZlangDirectProperty_guitreenode	*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreePath					*tree_path = NULL ;
	char						*p = NULL ;
	char						buf[ 256 ] = "" ;
	int32_t						str_len ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreenode_common->gtk_widget) ) ;
	tree_path = gtk_tree_model_get_path( tree_model , & (guitreenode_common->tree_iter) ) ;
	p = gtk_tree_path_to_string( tree_path );
	str_len = snprintf( buf , sizeof(buf)-1 , "%s" , p ) ;
	CallRuntimeFunction_string_SetStringValue( rt , (*tostr_obj) , buf , str_len ) ;
	gtk_tree_path_free( tree_path );
	
	return 0;
}

ZlangFromDataPtrFunction ZlangFromDataPtr_guitreenode;
int ZlangFromDataPtr_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj , void *value_ptr , int32_t value_len )
{
	struct ZlangDirectProperty_guitreenode	*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	
	memcpy( guitreenode_direct_prop , value_ptr , value_len );
	
	return 0;
}

ZlangGetDataPtrFunction ZlangGetDataPtr_guitreenode;
int ZlangGetDataPtr_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj , void **value_ptr , int32_t *value_len )
{
	struct ZlangDirectProperty_guitreenode	*guitreenode_direct_prop = GetObjectDirectProperty(obj) ;
	
	if( value_ptr )
		(*value_ptr) = guitreenode_direct_prop ;
	if( value_len )
		(*value_len) = sizeof(struct ZlangDirectProperty_guitreenode) ;
	return 0;
}

ZlangSummarizeDirectPropertySizeFunction ZlangSummarizeDirectPropertySize_guitreenode;
void ZlangSummarizeDirectPropertySize_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj , size_t *summarized_obj_size , size_t *summarized_direct_prop_size )
{
	SUMMARIZE_SIZE( summarized_direct_prop_size , sizeof(struct ZlangDirectProperty_guitreenode) )
	return;
}

static struct ZlangDirectFunctions direct_funcs_guitreenode =
	{
		ZLANG_OBJECT_guitreenode ,
		
		ZlangCreateDirectProperty_guitreenode ,
		ZlangDestroyDirectProperty_guitreenode ,
		
		NULL ,
		ZlangToString_guitreenode ,
		ZlangFromDataPtr_guitreenode ,
		ZlangGetDataPtr_guitreenode ,
		
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		
		NULL ,
		NULL ,
		
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		NULL ,
		
		ZlangSummarizeDirectPropertySize_guitreenode ,
	} ;

ZlangImportObjectFunction ZlangImportObject_guitreenode;
struct ZlangObject *ZlangImportObject_guitreenode( struct ZlangRuntime *rt )
{
	struct ZlangObject	*obj = NULL ;
	struct ZlangFunction	*func = NULL ;
	int			nret = 0 ;
	
	nret = ImportObject( rt , & obj , ZLANG_OBJECT_guitreenode , & direct_funcs_guitreenode , sizeof(struct ZlangDirectFunctions) , NULL ) ;
	if( nret )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_LINK_FUNC_TO_ENTITY , "import object to global objects heap" )
		DestroyObject( rt , obj );
		return NULL;
	}
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreenode_Copy , ZLANG_OBJECT_guitreenode , "Copy" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreenode_Up_guitreenode , ZLANG_OBJECT_guitreenode , "Up" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreenode_Down_guitreenode , ZLANG_OBJECT_guitreenode , "Down" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreenode_Next_guitreenode , ZLANG_OBJECT_guitreenode , "Next" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreenode_Prev_guitreenode , ZLANG_OBJECT_guitreenode , "Prev" , NULL ) ;
	if( func == NULL )
		return NULL;

	return obj ;
}

#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE		"zobjects_gtk_object_data_key_treetable_column_type"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_TOGGLE	"G"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_PROGRESS	"P"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_INT_TEXT	"I"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_DOUBLE_TEXT	"D"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_STRING_TEXT	"S"

#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_NAME		"zobjects_gtk_object_data_key_treetable_column_name"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TREETABLE_WIDGET	"zobjects_gtk_object_data_key_treetable_column_treetable_widget"
#define ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_NO		"zobjects_gtk_object_data_key_treetable_column_no"

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_Create_guiwindow;
int ZlangInvokeFunction_guitreetable_Create_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guitreetable_common->gtk_widget , gtk_tree_view_new() )
	SET_CONTROL_DEFAULT_STYLE( in1 , guitreetable_common->gtk_widget )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guitreetable_common->guiwindow_obj , in1 )

	return 0;
}

static void on_treetable_column_auto_toggling( GtkCellRendererToggle *cell_renderer , gchar *path_str , gpointer user_data )
{
	GtkTreeViewColumn	*column = (GtkTreeViewColumn *)user_data ;
	GtkWidget		*gtk_widget = (GtkWidget *)g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TREETABLE_WIDGET ) ;
	gint			col_no = GPOINTER_TO_INT( g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_NO ) ) ;
	GtkTreeModel		*tree_model = NULL ;
	GtkTreePath		*path = NULL ;
	GtkTreeIter		iter ;
	gboolean		active ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(gtk_widget) ) ;
	path = gtk_tree_path_new_from_string( path_str ) ;
	gtk_tree_model_get_iter( tree_model , & iter , path );
	gtk_tree_model_get( tree_model , & iter , col_no , & active , -1 );
	gtk_tree_store_set( GTK_TREE_STORE(tree_model) , & iter , col_no , !active , -1 );
	gtk_tree_path_free( path );

	return ;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_SetColumns_vargs;
int ZlangInvokeFunction_guitreetable_SetColumns_vargs( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*inN = NULL ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						in_count ;
	int32_t						in_no ;
	GType						*column_types_array = NULL ;
	int32_t						col_no ;
	GtkTreeStore					*tree_store = NULL ;
	GtkCellRenderer					*renderer = NULL ;
	void						*guitreecolumn_direct_prop = NULL ;
	struct ZlangDirectProperty_guiwidget_common	*guitreecolumn_common = NULL ;
	char						*column_name = NULL ;
	GtkTreeViewColumn				*column = NULL ;

	in_count = GetInputParameterCountInLocalObjectStack( rt ) ;
	column_types_array = g_malloc( sizeof(GType) * in_count ) ;
	if( column_types_array == NULL )
	{
		UnreferObject( rt , out1 );
		return ThrowErrorException( rt , ZLANG_ERROR_ALLOC , EXCEPTION_MESSAGE_NEW_GTK_OBJECT_FAILED );
	}
	memset( column_types_array , 0x00 , sizeof(GType) * in_count );

	for( in_no = 1 , col_no = 0 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		inN = GetInputParameterInLocalObjectStack( rt , in_no ) ;
		if( inN == NULL )
		{
			g_free( column_types_array );
			UnreferObject( rt , out1 );
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		guitreecolumn_direct_prop = GetObjectDirectProperty(inN) ;
		guitreecolumn_common = (struct ZlangDirectProperty_guiwidget_common *)guitreecolumn_direct_prop ;
		CallRuntimeFunction_string_GetStringValue( rt , guitreecolumn_common->zobjects_data.str_obj , & column_name , NULL );
		column_name = g_strdup( column_name ) ;

		if( IsTypeOf( rt , inN , QueryGlobalObjectByObjectName(rt,ZLANG_OBJECT_guitreecolumn_toggle) ) )
		{
			column_types_array[col_no] = G_TYPE_BOOLEAN ;

			renderer = gtk_cell_renderer_toggle_new() ;
			column = gtk_tree_view_column_new_with_attributes( column_name , renderer , "active" , col_no , NULL ) ;
			gtk_tree_view_append_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );
			g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_TOGGLE );
			g_signal_connect( renderer , GTK_EVENT_TOGGLED , G_CALLBACK (on_treetable_column_auto_toggling) , column );
		}
		else if( IsTypeOf( rt , inN , QueryGlobalObjectByObjectName(rt,ZLANG_OBJECT_guitreecolumn_progress) ) )
		{
			column_types_array[col_no] = G_TYPE_INT ;

			renderer = gtk_cell_renderer_progress_new() ;
			column = gtk_tree_view_column_new_with_attributes( column_name , renderer , "value" , col_no , "text" , col_no , NULL ) ;
			gtk_tree_view_append_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );
			g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_PROGRESS );
		}
		else if( IsTypeOf( rt , inN , QueryGlobalObjectByObjectName(rt,ZLANG_OBJECT_guitreecolumn_int_text) ) )
		{
			column_types_array[col_no] = G_TYPE_INT ;

			renderer = gtk_cell_renderer_text_new() ;
			column = gtk_tree_view_column_new_with_attributes( column_name , renderer , "text" , col_no , NULL ) ;
			gtk_tree_view_append_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );
			g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_INT_TEXT );
		}
		else if( IsTypeOf( rt , inN , QueryGlobalObjectByObjectName(rt,ZLANG_OBJECT_guitreecolumn_double_text) ) )
		{
			column_types_array[col_no] = G_TYPE_DOUBLE ;

			renderer = gtk_cell_renderer_text_new() ;
			column = gtk_tree_view_column_new_with_attributes( column_name , renderer , "text" , col_no , NULL ) ;
			gtk_tree_view_append_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );
			g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_DOUBLE_TEXT );
		}
		else if( IsTypeOf( rt , inN , QueryGlobalObjectByObjectName(rt,ZLANG_OBJECT_guitreecolumn_string_text) ) )
		{
			column_types_array[col_no] = G_TYPE_STRING ;

			renderer = gtk_cell_renderer_text_new() ;
			column = gtk_tree_view_column_new_with_attributes( column_name , renderer , "text" , col_no , NULL ) ;
			gtk_tree_view_append_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );
			g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_STRING_TEXT );
		}
		else
		{
			g_free( column_types_array );
			UnreferObject( rt , out1 );
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_OBJECT_TYPE_INVALID );
		}
		g_object_set_data_full( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_NAME , column_name , g_free );
		g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TREETABLE_WIDGET , guitreetable_common->gtk_widget );
		g_object_set_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_NO , GINT_TO_POINTER(col_no) );
	}

	tree_store = gtk_tree_store_newv( in_count , column_types_array ) ;
	if( tree_store == NULL )
	{
		g_free( column_types_array );
		UnreferObject( rt , out1 );
		return ThrowErrorException( rt , ZLANG_ERROR_ALLOC , EXCEPTION_MESSAGE_NEW_GTK_OBJECT_FAILED );
	}
	gtk_tree_view_set_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , GTK_TREE_MODEL(tree_store) );

	g_free( column_types_array );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_SetExpanderColumn_int;
int ZlangInvokeFunction_guitreetable_SetExpanderColumn_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						column_no ;
	GtkTreeViewColumn				*column = NULL ;

	CallRuntimeFunction_int_GetIntValue( rt , in1 , & column_no );

	column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column_no-1 ) ;
	gtk_tree_view_set_expander_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , column );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZLANG_INVOKE_FUNCTION_guiwidget_all_common_functions( treetable )

ZLANG_INVOKE_FUNCTION_guictl_all_common_functions( treetable )

static int SetColumnValue( struct ZlangRuntime *rt , struct ZlangObject *in , GtkTreeModel *tree_model , GtkTreeIter *new_iter , int col_no , char column_type )
{
	if( IsTypeOf( rt , in , GetBoolObjectInRuntimeObjectsHeap(rt) ) && column_type == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_TOGGLE[0] )
	{
		unsigned char	b ;
		CallRuntimeFunction_bool_GetBoolValue( rt , in , & b );
		gtk_tree_store_set( GTK_TREE_STORE(tree_model) , new_iter , col_no-1 , b , -1 );
	}
	else if( IsTypeOf( rt , in , GetIntObjectInRuntimeObjectsHeap(rt) ) && column_type == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_PROGRESS[0] )
	{
		int32_t		n ;
		CallRuntimeFunction_int_GetIntValue( rt , in , & n );
		gtk_tree_store_set( GTK_TREE_STORE(tree_model) , new_iter , col_no-1 , n , -1 );
	}
	else if( IsTypeOf( rt , in , GetIntObjectInRuntimeObjectsHeap(rt) ) && column_type == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_INT_TEXT[0] )
	{
		int32_t		n ;
		CallRuntimeFunction_int_GetIntValue( rt , in , & n );
		gtk_tree_store_set( GTK_TREE_STORE(tree_model) , new_iter , col_no-1 , n , -1 );
	}
	else if( IsTypeOf( rt , in , GetDoubleObjectInRuntimeObjectsHeap(rt) ) && column_type == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_DOUBLE_TEXT[0] )
	{
		double		d ;
		CallRuntimeFunction_double_GetDoubleValue( rt , in , & d );
		gtk_tree_store_set( GTK_TREE_STORE(tree_model) , new_iter , col_no-1 , d , -1 );
	}
	else if( IsTypeOf( rt , in , GetStringObjectInRuntimeObjectsHeap(rt) ) && column_type == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_STRING_TEXT[0] )
	{
		char		*str = NULL ;
		CallRuntimeFunction_string_GetStringValue( rt , in , & str , NULL );
		gtk_tree_store_set( GTK_TREE_STORE(tree_model) , new_iter , col_no-1 , str , -1 );
	}
	else
	{
		return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_PARAMETER_INVALID );
	}
	
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_vargs;
int ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_vargs( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeIter					new_child_iter ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*inN = NULL ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*in1_guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	GtkTreeIter					*parent_iter = NULL ;
	int32_t						col_no ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	in_count = GetInputParameterCountInLocalObjectStack( rt ) ;
	if( IsObjectPropertiesEntityNull(in1) )
		parent_iter = NULL ;
	else
		parent_iter = & (in1_guitreenode_direct_prop->common.tree_iter) ;
	gtk_tree_store_append( GTK_TREE_STORE(tree_model) , & new_child_iter , parent_iter );
	for( in_no = 2 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		inN = GetInputParameterInLocalObjectStack( rt , in_no ) ;
		if( inN == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , inN , tree_model , & new_child_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_child_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_guitreenode_array;
int ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_guitreenode_array( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeIter					new_child_iter ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack( rt , 2 ) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*in1_guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangObject				*in_obj = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	GtkTreeIter					*parent_iter = NULL ;
	int32_t						col_no ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	if( IsObjectPropertiesEntityNull(in1) )
		parent_iter = NULL ;
	else
		parent_iter = & (in1_guitreenode_direct_prop->common.tree_iter) ;
	gtk_tree_store_append( GTK_TREE_STORE(tree_model) , & new_child_iter , parent_iter );
	CallRuntimeFunction_array_Length( rt , in2 , & in_count );
	for( in_no = 1 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		CallRuntimeFunction_array_Get( rt , in2 , in_no , & in_obj );
		if( in_obj == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , in_obj , tree_model , & new_child_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_child_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_vargs;
int ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_vargs( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*inN = NULL ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeIter					parent_iter  ;
	GtkTreeIter					new_insert_iter  ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	int32_t						col_no ;
	unsigned char					bret ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	in_count = GetInputParameterCountInLocalObjectStack( rt ) ;
	bret = gtk_tree_model_iter_parent( tree_model , & parent_iter , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	gtk_tree_store_insert_before( GTK_TREE_STORE(tree_model) , & new_insert_iter , & parent_iter , & (guitreenode_common->tree_iter) );
	for( in_no = 2 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		inN = GetInputParameterInLocalObjectStack( rt , in_no ) ;
		if( inN == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , inN , tree_model , & new_insert_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_insert_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_guitreenode_array;
int ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_guitreenode_array( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack( rt , 2 ) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeIter					parent_iter  ;
	GtkTreeIter					new_insert_iter  ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangObject				*in_obj = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	int32_t						col_no ;
	unsigned char					bret ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	bret = gtk_tree_model_iter_parent( tree_model , & parent_iter , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	gtk_tree_store_insert_before( GTK_TREE_STORE(tree_model) , & new_insert_iter , & parent_iter , & (guitreenode_common->tree_iter) );
	CallRuntimeFunction_array_Length( rt , in2 , & in_count );
	for( in_no = 1 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		CallRuntimeFunction_array_Get( rt , in2 , in_no , & in_obj );
		if( in_obj == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , in_obj , tree_model , & new_insert_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_insert_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_vargs;
int ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_vargs( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*inN = NULL ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeIter					parent_iter  ;
	GtkTreeIter					new_insert_iter  ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	int32_t						col_no ;
	unsigned char					bret ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	in_count = GetInputParameterCountInLocalObjectStack( rt ) ;
	bret = gtk_tree_model_iter_parent( tree_model , & parent_iter , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	gtk_tree_store_insert_after( GTK_TREE_STORE(tree_model) , & new_insert_iter , & parent_iter , & (guitreenode_common->tree_iter) );
	for( in_no = 2 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		inN = GetInputParameterInLocalObjectStack( rt , in_no ) ;
		if( inN == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , inN , tree_model , & new_insert_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_insert_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_guitreenode_array;
int ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_guitreenode_array( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	int32_t						in_count ;
	int32_t						in_no ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack( rt , 1 ) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack( rt , 2 ) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeIter					parent_iter  ;
	GtkTreeIter					new_insert_iter  ;
	struct ZlangDirectProperty_guitreetable		*out1_guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangObject				*in_obj = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	int32_t						col_no ;
	unsigned char					bret ;
	int						nret = 0 ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	bret = gtk_tree_model_iter_parent( tree_model , & parent_iter , & (guitreenode_common->tree_iter) ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	gtk_tree_store_insert_after( GTK_TREE_STORE(tree_model) , & new_insert_iter , & parent_iter , & (guitreenode_common->tree_iter) );
	CallRuntimeFunction_array_Length( rt , in2 , & in_count );
	for( in_no = 1 , col_no = 1 ; in_no <= in_count ; in_no++ , col_no++ )
	{
		CallRuntimeFunction_array_Get( rt , in2 , in_no , & in_obj );
		if( in_obj == NULL )
		{
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_INTERNAL_ERROR );
		}

		column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
		p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

		nret = SetColumnValue( rt , in_obj , tree_model , & new_insert_iter , col_no , p_column_type[0] ) ;
		if( nret )
			return nret;
	}
	out1_guitreenode_direct_prop->common.gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (out1_guitreenode_direct_prop->common.tree_iter) , & new_insert_iter , sizeof(GtkTreeIter) );

	return 0;
}

static int tree_store_count_rows( GtkTreeModel *tree_model , GtkTreeIter *parent_iter )
{
	GtkTreeIter	iter;
	int		count = 0;

	if( gtk_tree_model_iter_children( tree_model , & iter , parent_iter ) )
	{
		do
		{
			count++;
			count += tree_store_count_rows( tree_model , & iter );
		}
		while( gtk_tree_model_iter_next( tree_model , & iter ) );
	}

	return count;
}

static int gtk_tree_view_get_n_rows( GtkTreeView *tree_view )
{
	GtkTreeModel		*tree_model = NULL ;

	tree_model = gtk_tree_view_get_model( tree_view );
	return tree_store_count_rows( tree_model , NULL );
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetColumnCount;
int ZlangInvokeFunction_guitreetable_GetColumnCount( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						col_count ;

	col_count = gtk_tree_view_get_n_columns( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	CallRuntimeFunction_int_SetIntValue( rt , out1 , col_count );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetRowCount;
int ZlangInvokeFunction_guitreetable_GetRowCount( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						row_count ;

	row_count = gtk_tree_view_get_n_rows( GTK_TREE_VIEW(guitreetable_common->gtk_widget) );
	CallRuntimeFunction_int_SetIntValue( rt , out1 , row_count );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetTreeNodeData_guitreenode_int;
int ZlangInvokeFunction_guitreetable_GetTreeNodeData_guitreenode_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	int32_t						col_no ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	GValue						cell_data = G_VALUE_INIT ;
	int						nret = 0 ;

	CallRuntimeFunction_int_GetIntValue( rt , in2 , & col_no );
	
	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
	p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

	gtk_tree_model_get_value( tree_model , & (guitreenode_common->tree_iter) , col_no-1 , & cell_data );
	if( G_VALUE_HOLDS_BOOLEAN(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_TOGGLE[0] )
	{
		unsigned char	b = g_value_get_boolean( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetBoolObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	}
	else if( G_VALUE_HOLDS_INT(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_PROGRESS[0] )
	{
		int32_t		n = g_value_get_int( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetIntObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_int_SetIntValue( rt , out1 , n );
	}
	else if( G_VALUE_HOLDS_INT(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_INT_TEXT[0] )
	{
		int32_t		n = g_value_get_int( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetIntObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_int_SetIntValue( rt , out1 , n );
	}
	else if( G_VALUE_HOLDS_DOUBLE(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_DOUBLE_TEXT[0] )
	{
		double		d = g_value_get_double( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetDoubleObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_double_SetDoubleValue( rt , out1 , d );
	}
	else if( G_VALUE_HOLDS_STRING(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_STRING_TEXT[0] )
	{
		const char	*str = g_value_get_string( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetStringObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_string_SetStringValue( rt , out1 , (char*)str , STRLEN_OF_STRING );
	}
	else
	{
		g_value_unset( & cell_data );
		UnreferObject( rt , out1 );
		return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_PARAMETER_INVALID );
	}
	g_value_unset( & cell_data );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_SetTreeNodeData_guitreenode_int_object;
int ZlangInvokeFunction_guitreetable_SetTreeNodeData_guitreenode_int_object( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	int32_t						col_no ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	int						nret = 0 ;

	CallRuntimeFunction_int_GetIntValue( rt , in2 , & col_no );

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
	p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

	nret = SetColumnValue( rt , in3 , tree_model , & (guitreenode_common->tree_iter) , col_no , p_column_type[0] ) ;
	if( nret )
	{
		CallRuntimeFunction_bool_SetBoolValue( rt , out1 , FALSE );
		return nret;
	}

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , TRUE );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_RemoveTreeNode_guitreenode;
int ZlangInvokeFunction_guitreetable_RemoveTreeNode_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	gtk_tree_store_remove( GTK_TREE_STORE(tree_model) , & (guitreenode_common->tree_iter) );

	CallRuntimeFunction_bool_SetBoolValue( rt , in1 , TRUE );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_RemoveTree;
int ZlangInvokeFunction_guitreetable_RemoveTree( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	gtk_tree_store_clear( GTK_TREE_STORE(tree_model) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetTreeRootNode;
int ZlangInvokeFunction_guitreetable_GetTreeRootNode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeIter					root_iter ;
	unsigned char					bret ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	bret = gtk_tree_model_get_iter_first( tree_model , & root_iter );
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	guitreenode_common->gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (guitreenode_common->tree_iter) , & root_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetTreeNodeFromPath_string;
int ZlangInvokeFunction_guitreetable_GetTreeNodeFromPath_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*path_str = NULL ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreePath					*tree_path = NULL ;
	GtkTreeIter					tree_iter ;
	unsigned char					bret ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & path_str , NULL );

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	tree_path = gtk_tree_path_new_from_string( path_str ) ;
	bret = gtk_tree_model_get_iter( tree_model , & tree_iter , tree_path );
	gtk_tree_path_free( tree_path );
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	guitreenode_common->gtk_widget = guitreetable_common->gtk_widget ;
	memcpy( & (guitreenode_common->tree_iter) , & tree_iter , sizeof(GtkTreeIter) );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetSelectedTreeNode;
int ZlangInvokeFunction_guitreetable_GetSelectedTreeNode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeSelection				*selection = NULL ;
	unsigned char					b ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(guitreetable_common->gtk_widget) );
	guitreenode_common->gtk_widget = guitreetable_common->gtk_widget ;
	b = gtk_tree_selection_get_selected( selection , & tree_model , & (guitreenode_common->tree_iter) ) ;
	if( b != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_GetSelectedTreeNodeData_int;
int ZlangInvokeFunction_guitreetable_GetSelectedTreeNodeData_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						col_no ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreeViewColumn				*column = NULL ;
	char						*p_column_type = NULL ;
	GtkTreeSelection				*selection = NULL ;
	GtkTreeIter					selected_iter ;
	GValue						cell_data = G_VALUE_INIT ;
	unsigned char					bret ;
	int						nret = 0 ;

	CallRuntimeFunction_int_GetIntValue( rt , in1 , & col_no );

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;
	selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(guitreetable_common->gtk_widget) );
	bret = gtk_tree_selection_get_selected( selection , & tree_model , & selected_iter ) ;
	if( bret != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	column = gtk_tree_view_get_column( GTK_TREE_VIEW(guitreetable_common->gtk_widget) , col_no-1 ) ;
	p_column_type = g_object_get_data( G_OBJECT(column) , ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE ) ;

	gtk_tree_model_get_value( tree_model , & selected_iter , col_no-1 , & cell_data );
	if( G_VALUE_HOLDS_BOOLEAN(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_TOGGLE[0] )
	{
		unsigned char	b = g_value_get_boolean( &cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetBoolObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	}
	else if( G_VALUE_HOLDS_INT(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_PROGRESS[0] )
	{
		int32_t		n = g_value_get_int( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetIntObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_int_SetIntValue( rt , out1 , n );
	}
	else if( G_VALUE_HOLDS_INT(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_INT_TEXT[0] )
	{
		int32_t		n = g_value_get_int( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetIntObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_int_SetIntValue( rt , out1 , n );
	}
	else if( G_VALUE_HOLDS_DOUBLE(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_DOUBLE_TEXT[0] )
	{
		double		d = g_value_get_double( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetDoubleObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_double_SetDoubleValue( rt , out1 , d );
	}
	else if( G_VALUE_HOLDS_STRING(&cell_data) && p_column_type[0] == ZOBJECTS_GTK_OBJECT_DATA_KEY_TREETABLE_COLUMN_TYPE_STRING_TEXT[0] )
	{
		const char	*str = g_value_get_string( & cell_data ) ;

		nret = CloneObject( rt , & out1 , NULL , GetStringObjectInRuntimeObjectsHeap(rt) ) ;
		if( nret )
		{
			g_value_unset( & cell_data );
			UnreferObject( rt , out1 );
			return nret;
		}

		CallRuntimeFunction_string_SetStringValue( rt , out1 , (char*)str , STRLEN_OF_STRING );
	}
	else
	{
		g_value_unset( & cell_data );
		UnreferObject( rt , out1 );
		return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_PARAMETER_INVALID );
	}
	g_value_unset( & cell_data );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guitreetable_IsTreeNodeSelected_guitreenode;
int ZlangInvokeFunction_guitreetable_IsTreeNodeSelected_guitreenode( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = & (guitreetable_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guitreetable		*guitreenode_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guitreenode_common = & (guitreenode_direct_prop->common) ;
	GtkTreeModel					*tree_model = NULL ;
	GtkTreePath					*path = NULL ;
	char						*path_str = NULL ;
	GtkTreeSelection				*selection = NULL ;
	GtkTreeIter					selected_iter ;
	GtkTreePath					*selected_path = NULL ;
	char						*selected_path_str = NULL ;
	unsigned char					b ;

	tree_model = gtk_tree_view_get_model( GTK_TREE_VIEW(guitreetable_common->gtk_widget) ) ;

	path = gtk_tree_model_get_path( tree_model , & (guitreenode_common->tree_iter) ) ;
	path_str = gtk_tree_path_to_string( path ) ;

	selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(guitreetable_common->gtk_widget) );
	b = gtk_tree_selection_get_selected( selection , & tree_model , & selected_iter ) ;
	if( b != TRUE )
	{
		UnreferObject( rt , out1 );
		return 0;
	}
	selected_path = gtk_tree_model_get_path( tree_model , & selected_iter ) ;
	selected_path_str = gtk_tree_path_to_string( selected_path ) ;
	if( STRCMP( path_str , == , selected_path_str ) )
		b = TRUE ;
	else
		b = FALSE ;

        gtk_tree_path_free( selected_path );
	g_free( selected_path_str );

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	return 0;
}

ZlangCreateDirectPropertyFunction ZlangCreateDirectProperty_guitreetable;
void *ZlangCreateDirectProperty_guitreetable( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable		*guitreetable_prop = NULL ;
	struct ZlangDirectProperty_guiwidget_common	*guitreetable_common = NULL ;
	
	guitreetable_prop = (struct ZlangDirectProperty_guitreetable *)ZLMALLOC( sizeof(struct ZlangDirectProperty_guitreetable) ) ;
	if( guitreetable_prop == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc memory for entity" )
		return NULL;
	}
	memset( guitreetable_prop , 0x00 , sizeof(struct ZlangDirectProperty_guitreetable) );

	guitreetable_common = (struct ZlangDirectProperty_guiwidget_common *)guitreetable_prop ;
	guitreetable_common->gtk_widget_type_id = GTK_TYPE_TREE_VIEW ;

	INIT_ZLANGDIRECTPROPERTY_guiwidget_common(guitreetable)
	
	return guitreetable_prop;
}

ZlangDestroyDirectPropertyFunction ZlangDestroyDirectProperty_guitreetable;
void ZlangDestroyDirectProperty_guitreetable( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guitreetable	*guitreetable_direct_prop = GetObjectDirectProperty(obj) ;
	
	CLEAN_ZLANGDIRECTPROPERTY_guiwidget_common(guitreetable)

	ZLFREE( guitreetable_direct_prop );
	
	return;
}

ZlangSummarizeDirectPropertySizeFunction ZlangSummarizeDirectPropertySize_guitreetable;
void ZlangSummarizeDirectPropertySize_guitreetable( struct ZlangRuntime *rt , struct ZlangObject *obj , size_t *summarized_obj_size , size_t *summarized_direct_prop_size )
{
	SUMMARIZE_SIZE( summarized_direct_prop_size , sizeof(struct ZlangDirectProperty_guitreetable) )
	return;
}

static struct ZlangDirectFunctions direct_funcs_guitreetable =
	{
		ZLANG_OBJECT_guitreetable , /* char *ancestor_name */
		
		ZlangCreateDirectProperty_guitreetable , /* ZlangCreateDirectPropertyFunction *create_entity_func */
		ZlangDestroyDirectProperty_guitreetable , /* ZlangDestroyDirectPropertyFunction *destroy_entity_func */
		
		NULL , /* ZlangFromCharPtrFunction *from_char_ptr_func */
		NULL , /* ZlangToStringFunction *to_string_func */
		NULL , /* ZlangFromDataPtrFunction *from_data_ptr_func */
		NULL , /* ZlangGetDataPtrFunction *get_data_ptr_func */
		
		NULL , /* ZlangOperatorFunction *oper_PLUS_func */
		NULL , /* ZlangOperatorFunction *oper_MINUS_func */
		NULL , /* ZlangOperatorFunction *oper_MUL_func */
		NULL , /* ZlangOperatorFunction *oper_DIV_func */
		NULL , /* ZlangOperatorFunction *oper_MOD_func */
		
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NEGATIVE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NOT_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_BIT_REVERSE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_PLUS_PLUS_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_MINUS_MINUS_func */
		
		NULL , /* ZlangCompareFunction *comp_EGUAL_func */
		NULL , /* ZlangCompareFunction *comp_NOTEGUAL_func */
		NULL , /* ZlangCompareFunction *comp_LT_func */
		NULL , /* ZlangCompareFunction *comp_LE_func */
		NULL , /* ZlangCompareFunction *comp_GT_func */
		NULL , /* ZlangCompareFunction *comp_GE_func */
		
		NULL , /* ZlangLogicFunction *logic_AND_func */
		NULL , /* ZlangLogicFunction *logic_OR_func */
		
		NULL , /* ZlangLogicFunction *bit_AND_func */
		NULL , /* ZlangLogicFunction *bit_XOR_func */
		NULL , /* ZlangLogicFunction *bit_OR_func */
		NULL , /* ZlangLogicFunction *bit_MOVELEFT_func */
		NULL , /* ZlangLogicFunction *bit_MOVERIGHT_func */
		
		ZlangSummarizeDirectPropertySize_guitreetable , /* ZlangSummarizeDirectPropertySizeFunction *summarize_direct_prop_size_func */
	} ;

ZlangImportObjectFunction ZlangImportObject_guitreetable;
struct ZlangObject *ZlangImportObject_guitreetable( struct ZlangRuntime *rt )
{
	struct ZlangObject	*obj = NULL ;
	struct ZlangObject	*prop = NULL ;
	struct ZlangFunction	*func = NULL ;
	int			nret = 0 ;
	
	nret = ImportObject( rt , & obj , ZLANG_OBJECT_guitreetable , & direct_funcs_guitreetable , sizeof(struct ZlangDirectFunctions) , NULL ) ;
	if( nret )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_LINK_FUNC_TO_ENTITY , "import object to global objects heap" )
		return NULL;
	}
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "SINGLE_SELECTION_MODAL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUISELECTION_MODAL_SINGLE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "MULTI_SELECTION_MODAL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUISELECTION_MODAL_MULTI );
	SetConstantObject( prop );
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_Create_guiwindow , ZLANG_OBJECT_guitreetable , "Create" , ZLANG_OBJECT_guiwindow,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_SetColumns_vargs , ZLANG_OBJECT_guitreetable , "SetColumns" , ZLANG_OBJECT_vargs,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_SetExpanderColumn_int , ZLANG_OBJECT_guitreetable , "SetExpanderColumn" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guiwidget_all_common_functions( treetable )

	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guictl_all_common_functions( treetable )

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_vargs , ZLANG_OBJECT_guitreenode , "AddTreeNodeDatas" , ZLANG_OBJECT_vargs,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_AddTreeNodeDatas_guitreenode_array , ZLANG_OBJECT_guitreenode , "AddTreeNodeDatas" , ZLANG_OBJECT_guitreenode,NULL , ZLANG_OBJECT_array,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_vargs , ZLANG_OBJECT_guitreenode , "InsertTreeNodeDatasBefore" , ZLANG_OBJECT_vargs,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasBefore_guitreenode_array , ZLANG_OBJECT_guitreenode , "InsertTreeNodeDatasBefore" , ZLANG_OBJECT_guitreenode,NULL , ZLANG_OBJECT_array,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_vargs , ZLANG_OBJECT_guitreenode , "InsertTreeNodeDatasAfter" , ZLANG_OBJECT_vargs,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_InsertTreeNodeDatasAfter_guitreenode_array , ZLANG_OBJECT_guitreenode , "InsertTreeNodeDatasAfter" , ZLANG_OBJECT_guitreenode,NULL , ZLANG_OBJECT_array,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetColumnCount , ZLANG_OBJECT_int , "GetColumnCount" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetRowCount , ZLANG_OBJECT_int , "GetRowCount" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetTreeNodeData_guitreenode_int , ZLANG_OBJECT_object , "GetTreeNodeData" , ZLANG_OBJECT_guitreenode,NULL , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_SetTreeNodeData_guitreenode_int_object , ZLANG_OBJECT_bool , "SetTreeNodeData" , ZLANG_OBJECT_guitreenode,NULL , ZLANG_OBJECT_int,NULL , ZLANG_OBJECT_object,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_RemoveTreeNode_guitreenode , ZLANG_OBJECT_bool , "RemoveTreeNode" , ZLANG_OBJECT_guitreenode,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_RemoveTree , ZLANG_OBJECT_void , "RemoveTree" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetTreeRootNode , ZLANG_OBJECT_guitreenode , "GetTreeRootNode" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetTreeNodeFromPath_string , ZLANG_OBJECT_guitreenode , "GetTreeNodeFromPath" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetSelectedTreeNode , ZLANG_OBJECT_guitreenode , "GetSelectedTreeNode" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_GetSelectedTreeNodeData_int , ZLANG_OBJECT_object , "GetSelectedTreeNodeData" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guitreetable_IsTreeNodeSelected_guitreenode , ZLANG_OBJECT_bool , "IsTreeNodeSelected" , ZLANG_OBJECT_guitreenode,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	return obj ;
}
